const plugin = requirePlugin('zhgeo-plugin')
// plugin.setServeUrl('http://192.168.2.18:8000')
Page({
  data: {
    rootScenicId: 0
  },
  onLoad(options) {
    if (options.scene) {
        this.setData({
          rootScenicId: parseInt(options.scene)
        })
    } else {
        this.setData({
          rootScenicId: options.rootScenicId ?? 0
        })
    }
    // this.setData({
    //     rootScenicId: rootScenicId
    //   })
  },
  onUnload: function () {
    plugin.onUnloadPage();
  },

  changeScenic: function(e) {
    this.pageRouter.navigateTo({
      url: 'index?rootScenicId=' + e.detail.scenicId
    })
  },

  redirectScenic: function(e) {
    this.pageRouter.redirectTo({
      url: 'index?rootScenicId=' + e.detail.scenicId
    })
  },

  updateBarTitle: function(e) {
    wx.setNavigationBarTitle({
        title: e.detail.scenicName
    })
  }
})
